<template>
  <div class="privilegecreate">
    <div class="header" style="height:50px;margin-top:10px;margin-left:20px">
      <el-page-header @back="goBack"></el-page-header>
    </div>
    <div class="form">
      <el-form
        label-width="200px"
        class="demo-ruleForm">
        <el-form-item label="realname" style="width:50%">
          <el-input v-model="form.realname"></el-input>
        </el-form-item>
        <el-form-item label="mothod">
          <el-select v-model="form.route" placeholder="请选择接口调用方法">
            <el-option label="GET" value="GET"></el-option>
            <el-option label="POST" value="POST"></el-option>
            <el-option label="DEL" value="DEL"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="时间" style="width:50%">
          <el-input v-model="form.logTime"></el-input>
        </el-form-item>
        <el-form-item label="内容" style="width:70%">
          <el-input type="textarea" :rows="1" v-model="form.content"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="submitHandler">立即创建</el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>
<script>
import { post } from '@/utils/request';
export default {
  data() {
    return {
      form: {},
    };
  },
  created(){
    this.form=this.$route.query;
  },
  methods: {
    submitHandler(){
      let url="http://39.106.31.187:8888/BaseLog/saveOrUpdate"
      post(url,this.form).then(resp=>{
          this.$message({type:"success",message:resp.message})
          this.goBack();
      })

    },
    goBack() {
      this.$router.back();
    },
  },
};
</script>